Add unicsv format to for xsv where first list describes subsequent data.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 12 Jan 2006 19:59:58 +0000 (19:59 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 12 Jan 2006 19:59:58 +0000 (19:59 +0000)
gpsbabel/Makefile
gpsbabel/ignrando.c
gpsbabel/readme.xml
gpsbabel/reference/unicsv.gpx [new file with mode: 0644]
gpsbabel/testo
gpsbabel/vecs.c
gpsbabel/yahoo.c

index 2adebd792e1e3f73792248fca7e646fdbe7aead5..e45d607654701a3ac70485ba1a21d02a19c6a637 100644 (file)
@@ -45,7 +45,7 @@ FMTS=magproto.o gpx.o geo.o mapsend.o mapsource.o garmin_tables.o \
        vcf.o overlay.o kml.o google.o lowranceusr.o an1.o tomtom.o \
        tef_xml.o maggeo.o pathaway.o vitosmt.o gdb.o bcr.o coto.o \
        ignrando.o stmwpp.o msroute.o cst.o nmn4.o mag_pdb.o compegps.o \
-       yahoo.o
+       yahoo.o unicsv.o
 
 FILTERS=position.o duplicate.o arcdist.o polygon.o smplrout.o \
        reverse_route.o sort.o stackfilter.o trackfilter.o discard.o \
@@ -305,6 +305,7 @@ tpg.o: tpg.c defs.h queue.h gbtypes.h jeeps/gpsmath.h jeeps/gps.h \
   jeeps/gpsmem.h jeeps/gpsrqst.h jeeps/gpsinput.h jeeps/gpsproj.h \
   jeeps/gpsnmeafmt.h jeeps/gpsnmeaget.h
 trackfilter.o: trackfilter.c defs.h queue.h gbtypes.h strptime.h
+unicsv.o: unicsv.c defs.h queue.h gbtypes.h csv_util.h
 util.o: util.c defs.h queue.h gbtypes.h
 util_crc.o: util_crc.c
 uuid.o: uuid.c uuid.h
index 5e0dc20410813a4cb265933afbe431544420b0ae..0325e3a4bb52256b5b86cdec8f86132f182b7720 100644 (file)
 
 #if !NO_EXPAT
 #include <expat.h>
-static XML_Parser psr;
 #endif
 
 #define MYNAME "IGNRando"
 
-static FILE *fin, *fout;
+static FILE *fout;
 
 static route_head *track;
 static waypoint *wpt;
index 4e64799affc4efaf7da564b3ed262debcd76188f..6e6a4c836e5f7046f0ab0f13853d4c4a133292ed 100644 (file)
@@ -1530,6 +1530,34 @@ continental U.S. Points in Hawaii should use "Old
 Hawaiian_mean"</para>
       <para>Contributed by Alex Mottram.</para>
     </section>
+       <section id="unicsv">
+       <sectioninfo>
+         <subtitle>Universal csv with field structure in first line.</subtitle>
+       </sectioninfo>
+        <title>unicsv</title>
+       <para>
+       Unicsv examines the first line of a file to determine the field
+       order and field separator in that file.   It is thus read-only format.
+       </para>
+       <para>
+       If the first line contains any tabs, the data lines are assumed 
+       to be tab separated.   Otherwise the fields are assumed to be 
+       separated by commas.
+       </para>
+       <para>
+       The list of keywords include "lat", "lon", "desc", "name", 
+       "notes", "alt", and "url".   Fuller spellings (i.e. "longitude") may
+       be used.
+       </para>
+       <para>
+       A typical file may be:
+       <screen format="linespecific">
+       Name, Latitude, Longitude, Description 
+       GCEBB,35.972033,-87.134700,Mountain Bike Heaven by susy1313
+       GC1A37,36.090683,-86.679550,The Troll by a182pilot &amp; Family
+       </screen>
+       </para>
+       </section>
     <section id="vcard">
       <sectioninfo>
        <subtitle>vCard format for Apple iPod etc.</subtitle>
diff --git a/gpsbabel/reference/unicsv.gpx b/gpsbabel/reference/unicsv.gpx
new file mode 100644 (file)
index 0000000..b52cbe7
--- /dev/null
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gpx
+ version="1.0"
+creator="GPSBabel - http://www.gpsbabel.org"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xmlns="http://www.topografix.com/GPX/1/0"
+xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
+<time>1970-01-01T00:00:00Z</time>
+<bounds minlat="35.972030000" minlon ="-87.134700000" maxlat="36.112180000" maxlon="-86.620120000" />
+<wpt lat="35.972030000" lon="-87.134700000">
+  <name> &quot;GCEBB&quot;</name>
+  <cmt> &quot;Mountain Bike Heaven by susy1313&quot;</cmt>
+  <desc> &quot;Mountain Bike Heaven by susy1313&quot;</desc>
+</wpt>
+<wpt lat="36.090680000" lon="-86.679550000">
+  <name> &quot;GC1A37&quot;</name>
+  <cmt> &quot;The Troll by a182pilot &amp; Family&quot;</cmt>
+  <desc> &quot;The Troll by a182pilot &amp; Family&quot;</desc>
+</wpt>
+<wpt lat="35.996270000" lon="-86.620120000">
+  <name> &quot;GC1C2B&quot;</name>
+  <cmt> &quot;Dive Bomber by JoGPS &amp; family&quot;</cmt>
+  <desc> &quot;Dive Bomber by JoGPS &amp; family&quot;</desc>
+</wpt>
+<wpt lat="36.038480000" lon="-86.648620000">
+  <name> &quot;GC25A9&quot;</name>
+  <cmt> &quot;FOSTER by JoGPS &amp; Family&quot;</cmt>
+  <desc> &quot;FOSTER by JoGPS &amp; Family&quot;</desc>
+</wpt>
+<wpt lat="36.112180000" lon="-86.741770000">
+  <name> &quot;GC2723&quot;</name>
+  <cmt> &quot;Logan Lighthouse by JoGps &amp; Family&quot;</cmt>
+  <desc> &quot;Logan Lighthouse by JoGps &amp; Family&quot;</desc>
+</wpt>
+<wpt lat="36.064080000" lon="-86.790520000">
+  <name> &quot;GC2B71&quot;</name>
+  <cmt> &quot;Ganier Cache by Susy1313&quot;</cmt>
+  <desc> &quot;Ganier Cache by Susy1313&quot;</desc>
+</wpt>
+<wpt lat="36.087770000" lon="-86.809730000">
+  <name> &quot;GC309F&quot;</name>
+  <cmt> &quot;Shy&apos;s Hill by FireFighterEng33&quot;</cmt>
+  <desc> &quot;Shy&apos;s Hill by FireFighterEng33&quot;</desc>
+</wpt>
+<wpt lat="36.057500000" lon="-86.892000000">
+  <name> &quot;GC317A&quot;</name>
+  <cmt> &quot;GittyUp by JoGPS / Warner Parks&quot;</cmt>
+  <desc> &quot;GittyUp by JoGPS / Warner Parks&quot;</desc>
+</wpt>
+<wpt lat="36.082800000" lon="-86.867280000">
+  <name> &quot;GC317D&quot;</name>
+  <cmt> &quot;Inlighting by JoGPS / Warner Parks&quot;</cmt>
+  <desc> &quot;Inlighting by JoGPS / Warner Parks&quot;</desc>
+</wpt>
+</gpx>
index 8206d0ae6aab878bd3c3e839ee9150a01791cfc4..64fee0356696a3ecd65915801bbef9bd9676dd7d 100755 (executable)
@@ -947,4 +947,12 @@ ${PNAME} -i gpx -f ${TMPDIR}/alltypes.gpx -x nuketypes,waypoints,tracks -o gpx -
 ${PNAME} -i gpx -f ${TMPDIR}/wpts.gpx -f ${TMPDIR}/trks.gpx -f ${TMPDIR}/rtes.gpx -o gpx -F ${TMPDIR}/merged.gpx
 compare ${TMPDIR}/alltypes.gpx ${TMPDIR}/merged.gpx
 
+#
+# Universal CSV - unicsv
+#
+echo "lat,lon,descr,name,notes,unk,unk" > ${TMPDIR}/unicsv.txt
+cat reference/mxf.mxf >> ${TMPDIR}/unicsv.txt
+${PNAME} -i unicsv -f ${TMPDIR}/unicsv.txt -o gpx -F ${TMPDIR}/unicsv.gpx
+compare ${TMPDIR}/unicsv.gpx reference/unicsv.gpx
+
 exit 0
index 322f2de82bdd105cadc717dd6e02515bec159700..d53fcda5ca7d87649d31061f4d6a2aed56bcfc5b 100644 (file)
@@ -95,6 +95,7 @@ extern ff_vecs_t nmn4_vecs;
 extern ff_vecs_t magpdb_vecs;
 extern ff_vecs_t compegps_vecs;
 extern ff_vecs_t yahoo_vecs;
+extern ff_vecs_t unicsv_vecs;
 
 static
 vecs_t vec_list[] = {
@@ -489,6 +490,12 @@ vecs_t vec_list[] = {
                "Yahoo Geocode API data",
                NULL
        },
+       {
+               &unicsv_vecs,
+               "unicsv",
+               "Universal csv with field structure in first line",
+               NULL
+       },
        {
                NULL,
                NULL,
index 60a365a6a8f5a4dc8d61f0d7ef02379839567980..015f2572c312572e2c2e1b137f99c9fe0fca55da 100644 (file)
@@ -22,7 +22,6 @@
 #include "defs.h"
 #include "xmlgeneric.h"
 
-static FILE *ifd;
 static waypoint *wpt_tmp;
 static char *as;